<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>作品展示详情页</title>
    <link href="${server}/css/bootstrap.css" rel="stylesheet"/>
    <link href="${server}/css/main.css" rel="stylesheet"/>
    <link href="${server}/css/worksInfo.css" rel="stylesheet">
</head>
<body>
<#include "nav.ftl">

<div class="info_content main  mar_auto">
    <div class="info_top">
        <div class="work_title">
            <h2>作品名：${work.name}</h2>
            <p>作品分类：${work.classes}</p>
        </div>
        <div class="work_author">
            <a href="#"><img src="${work.author.img}" alt="author_img"></a>
            <div class="work_data">
                <a href="#" class="author_link">${work.author.username}</a>
                <p>发布时间：${work.publicTime?string("yyyy-MM-dd HH:mm:ss")}</p>
            </div>
        </div>
    </div>
    <div class="work_detail">
    ${work.info}
    </div>
    <div class="work_like">
        <a href="#" id="recommend"><span class="glyphicon glyphicon-thumbs-up"></span>推荐&nbsp;<span
                id="recommendNum">${work.recommendNumber}</span></a>
        <a href="#" id="collection"><span class="glyphicon glyphicon-star-empty"></span>收藏&nbsp;${work.collectionNumber}
        </a>
        <a style="float:right;margin-right: 1em"><span
                class="glyphicon glyphicon-eye-open"></span>浏览量&nbsp;${work.overNumber}</a>
    </div>
    <br/>
    <div class="comment">
        <div class="comment_top">
            <label>评论</label>
        </div>
        <div class="comment_in">
            <textarea class="form-control" name="info" id="info"></textarea>

            <input type="hidden" name="wid" value="${work.wid}">
            <button class="btn mybtn" id="submitComments">发表</button>
        </div>
        <div class="all_comment clear">
            <div class="comment_top">
                <span>全部评论<#if (listComments?size > 0)>${listComments?size}<#else >0</#if></span>
            </div>
            <div class="comment_content clear">
            <#list listComments as userComments>

                <div class="comment_info clear">
                    <img src="${userComments.user.img}" alt="用户头像">
                    <div class="content_top">
                        <a href="#">${userComments.user.username}</a>
                        <span>${userComments.ago}</span>
                    </div>
                    <div class="content_main">
                    ${userComments.info}
                    </div>
                    <div class="content_footer">
                        <a href="#" class="ico3">${userComments.time?string("yyyy-MM-dd HH:mm:ss")}</a>
                    </div>
                </div>
            </#list>
            </div>
        </div>

    </div>

</div>


<div id="footer_bg">
    <div class="footer clear">
        <div class="f1">联系我们</div>
        <div class="f2">
            <ul>
                <li>微信公众号：abc912342642</li>
                <li>新浪微博：郑州轻院计算机学院创业中心</li>
                <li>Email:zzuli_cyzx@163.com</li>
                <li>地址：计算机楼108</li>
            </ul>
        </div>
        <div class="f3">
            <img src="${server}/img/About/weixin.jpg" alt="weixin"/>
            <p>创业中心微信</p>
        </div>
        <div><img src="${server}/img/About/weibo.jpg" alt="weibo"/>
            <p>创业中心微信</p></div>
    </div>
</div>
</body>
<#if loginTip??>
<script>
    alert("${loginTip}");
</script>
</#if>
<script src="${server}/js/jquery.min.js"></script>
<script src="${server}/js/bootstrap.min.js"></script>
<script src="${server}/js/main.js"></script>
<script>
    $('#Recommend').click(function () {
        $.ajax({
            type: "get",
            url: "${server}/recommendWork",
            data: {"wid":${work.wid}},
            success: function (data) {
                alert(data);
                window.location.reload();
            }
        })
    })
    $('#Collection').click(function () {
        $.ajax({
            type: "get",
            url: "${server}/collectWork",
            data: {"wid":${work.wid}},
            success: function (data) {
                alert(data);
                window.location.reload();
            }
        })
    })
    $('#submitComments').click(function () {
        $.ajax({
            type: "get",
            url: "${server}/commentWork",
            data: {"wid":${work.wid}, "info": $('#info').val()},
            success: function () {
                window.location.reload();
            }
        })
    })
</script>
</html>